//
//  QYGCurrentRoomFrameEntity.m
//  wawaji_ios
//
//  Created by 云+物娱 on 2017/12/2.
//  Copyright © 2017年 yiguo qi. All rights reserved.
//

#import "QYGCurrentRoomFrameEntity.h"
#import "QYGRoomChangedModel.h"
#import "NSString+Utility.h"

@implementation QYGCurrentRoomFrameEntity

- (void)setRoomChangeModel:(QYGRoomChangedModel *)roomChangeModel{
    _roomChangeModel = roomChangeModel;
    
    
    //3.头像
    CGFloat iconContentViewX = 0;
    CGFloat iconContentViewY = ScaleW(5);
    CGFloat iconViewW = ScaleW(24);
    CGFloat iconViewH = ScaleW(24);
    
    if(roomChangeModel.avatars.count == 1){
        
        _iconContentViewF = CGRectMake(iconContentViewX, iconContentViewY, iconViewW + ScaleW(5), iconViewH);
        
    }else if(roomChangeModel.avatars.count == 2){
        _iconContentViewF = CGRectMake(iconContentViewX, iconContentViewY, 2 *(iconViewW + ScaleW(5)), iconViewH);
    }else if(roomChangeModel.avatars.count >= 3){
        
        _iconContentViewF = CGRectMake(iconContentViewX, iconContentViewY, 3 *(iconViewW + ScaleW(5)), iconViewH);
    }
//    else{
//        _iconContentViewF = CGRectMake(iconContentViewX, iconContentViewY, 3 *iconViewW + 2 * ScaleW(3), iconViewH);
//
//        CGFloat moreImgviewW = ScaleW(20);
//        CGFloat moreImgviewH = ScaleW(30);
//        CGFloat moreImgviewX = CGRectGetMaxX(_iconContentViewF) + ScaleW(3);
//        CGFloat moreImgviewY = iconContentViewY;
//        _moreImgviewF = CGRectMake(moreImgviewX, moreImgviewY, moreImgviewW, moreImgviewH);
//
//        _currRoomWith = CGRectGetMaxX(_moreImgviewF) + ScaleW(10);
//    }
    
    //1. 房间人数
    
    CGFloat numLabelY = ScaleW(2) ;
    CGFloat numLabelX = CGRectGetMaxX(_iconContentViewF);
    NSString *numStr = [NSString stringWithFormat:@"%ld人",roomChangeModel.count];
    CGSize numLabelSize = [numStr sizeWithFont:ScaleFont(12) maxSize:CGSizeMake(CGFLOAT_MAX, ScaleW(13))];
    CGFloat numLabelW = numLabelSize.width + ScaleW(10);
    CGFloat numLabelH = ScaleW(30);
    
    _numLabelF = CGRectMake(numLabelX, numLabelY, numLabelW, numLabelH);
    
    // 2. 描述
//    CGFloat detailX = numLabelX;
//    CGFloat detailY = CGRectGetMaxY(_numLabelF) + ScaleW(3);
//    CGFloat detailW = numLabelW;
//    CGFloat detailH = numLabelH;
//    _detailLabelF = CGRectMake(detailX, detailY, detailW, detailH);

    if(roomChangeModel.avatars.count == 0){
        _currRoomHeight = 0;
        _currRoomWith = 0;
        
    }else{
        _currRoomWith = CGRectGetMaxX(_numLabelF) + ScaleW(3) + ScaleW(20);
        _currRoomHeight = ScaleW(34);
    }
    
}

@end
